/*
 Navicat Premium Data Transfer

 Source Server         : 192.168.64.2
 Source Server Type    : MySQL
 Source Server Version : 50741 (5.7.41)
 Source Host           : 192.168.64.2:3306
 Source Schema         : rbac

 Target Server Type    : MySQL
 Target Server Version : 50741 (5.7.41)
 File Encoding         : 65001

 Date: 23/04/2023 05:52:34
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for permission
-- ----------------------------
DROP TABLE IF EXISTS `permission`;
CREATE TABLE `permission` (
  `name` varchar(32) DEFAULT NULL COMMENT '权限英文名',
  `nameZh` varchar(32) DEFAULT NULL COMMENT '权限中文名',
  `id` int(10) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of permission
-- ----------------------------
BEGIN;
INSERT INTO `permission` (`name`, `nameZh`, `id`) VALUES ('admin:read', 'admin:read', 1);
INSERT INTO `permission` (`name`, `nameZh`, `id`) VALUES ('admin:write', 'admin:write', 2);
COMMIT;

-- ----------------------------
-- Table structure for role
-- ----------------------------
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '角色id',
  `name` varchar(32) DEFAULT NULL COMMENT '角色英文名',
  `nameZh` varchar(32) DEFAULT NULL COMMENT '角色中文名',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of role
-- ----------------------------
BEGIN;
INSERT INTO `role` (`id`, `name`, `nameZh`) VALUES (1, 'admin', '管理员');
INSERT INTO `role` (`id`, `name`, `nameZh`) VALUES (2, 'boss', '老板');
COMMIT;

-- ----------------------------
-- Table structure for role_permission
-- ----------------------------
DROP TABLE IF EXISTS `role_permission`;
CREATE TABLE `role_permission` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '表id',
  `role_id` int(11) DEFAULT NULL COMMENT '角色id',
  `permission_id` int(11) DEFAULT NULL COMMENT '权限id',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of role_permission
-- ----------------------------
BEGIN;
INSERT INTO `role_permission` (`id`, `role_id`, `permission_id`) VALUES (1, 1, 1);
INSERT INTO `role_permission` (`id`, `role_id`, `permission_id`) VALUES (2, 1, 2);
INSERT INTO `role_permission` (`id`, `role_id`, `permission_id`) VALUES (3, 2, 1);
INSERT INTO `role_permission` (`id`, `role_id`, `permission_id`) VALUES (4, 2, 2);
COMMIT;

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户id',
  `username` varchar(32) DEFAULT NULL COMMENT '用户名',
  `password` varchar(255) DEFAULT NULL COMMENT '加密后的密码',
  `enabled` tinyint(1) DEFAULT NULL COMMENT '账户是否可用',
  `accountNonExpired` tinyint(1) DEFAULT NULL COMMENT '账户是否没有过期',
  `accountNonLocked` tinyint(1) DEFAULT NULL COMMENT '账户是否没有锁定',
  `credentialNonExpired` tinyint(1) DEFAULT NULL COMMENT '凭证是否没有过期',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of user
-- ----------------------------
BEGIN;
INSERT INTO `user` (`id`, `username`, `password`, `enabled`, `accountNonExpired`, `accountNonLocked`, `credentialNonExpired`) VALUES (1, 'lglbc', '{noop}lglbc', 1, 1, 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for user_role
-- ----------------------------
DROP TABLE IF EXISTS `user_role`;
CREATE TABLE `user_role` (
  `user_id` int(11) DEFAULT NULL COMMENT '用户id',
  `role_id` int(11) DEFAULT NULL COMMENT '角色id'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of user_role
-- ----------------------------
BEGIN;
INSERT INTO `user_role` (`user_id`, `role_id`) VALUES (1, 1);
INSERT INTO `user_role` (`user_id`, `role_id`) VALUES (1, 2);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
